<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>作者列表</title>
    <!-- 引入Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- 引入自定义 CSS -->
    <link href="<%= request.getContextPath() %>/resources/custom.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
    <h1 class="mb-4">作者列表</h1>
    <div class="d-flex justify-content-between align-items-center mb-3">
        <form action="AuthorServlet" method="get" class="d-flex w-auto">
            <input type="text" name="authorName" placeholder="请输入作者姓名" class="form-control me-2" style="width: 200px;">
            <button type="submit" class="btn btn-primary">查询</button>
        </form>
    </div>
    <table class="table table-striped table-hover">
        <thead>
        <tr>
            <th scope="col">#</th>
            <th scope="col">姓名</th>
            <th scope="col">国籍</th>
            <th scope="col">操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach items="${authorsList}" var="author">
            <tr>
                <td>${author.author_id}</td>
                <td>${author.author_name}</td>
                <td>${author.author_nation}</td>
                <td>
                    <a href="authorServlet?action=detail&authorId=${author.author_id}" class="btn btn-info btn-sm">详情</a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</div>

<!-- 引入Bootstrap JS 和 Popper.js -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script>
</body>
</html>
